/*
 * @Description: 
 * @Version: 1.0
 * @Autor: lairensi
 * @Date: 2021-08-31 12:45:20
 * @LastEditors: lairensi
 * @LastEditTime: 2021-08-31 12:48:15
 */

/*
 * @Author: yuzc 
 * @Date: 2020-08-12 14:24:28 
 * @Last Modified by: yuzc
 * @Last Modified time: 2020-08-13 14:12:35
 * 
 * 
 * 提供一个loading
 * 
 * Loading _loading = new Loading();
 * _loading.showLoading(context,text);
 * _loading.closeLoading(context);
 * 
 */
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ToastMsg {
  // 显示toast
  void showToastMsg({
    @required String msg,
    Toast toastLength = Toast.LENGTH_SHORT,
    int timeInSecForIos = 2,
    double fontSize = 12.0,
    ToastGravity gravity = ToastGravity.CENTER,
    Color backgroundColor = Colors.black87,
    Color textColor = Colors.white,
    // Function(bool) didTap,
  }) {
    Fluttertoast.showToast(
        msg: "$msg",
        fontSize: 12.sp,
        toastLength: toastLength,
        gravity: gravity,
        timeInSecForIosWeb: timeInSecForIos,
        backgroundColor: backgroundColor,
        textColor: textColor);
  }

  // 关闭toast
  void closeToastMsg() {
    Fluttertoast.cancel();
  }
}
